<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>天气案例</title>
    <!-- 引入Vue -->
    <script type="text/javascript" src="../../vue.js"></script>
  </head>
  <body>
    <!-- 准备好一个容器-->
    <div id="demo">
      <h2>今天天气很{{text}}</h2>
      <!-- <button @click="changeWeather">切换天气</button> -->
      <button @click="isHot = !isHot">切换天气</button>
    </div>

    <script type="text/javascript">
      new Vue({
        el:'#demo',
        data:{
          isHot:true,
        },
        computed:{
          text(){
            return this.isHot ? '炎热' : '凉爽'
          }
        },
        methods:{
          changeWeather(){
            this.isHot = !this.isHot
          }
        }
      })
    </script>
  </body>
</html>